<template>
	<div>
		<div class="searchForm">
		    <div class="flex">
		        用户手机号： 
				<selectUser @callEnter="search" ref="selectUser" @getUserId="getUserId"  />
			</div>
			<div class="flex">
			    状态： 
				<el-select v-model="search_form.status" 
					size="mini"
					placeholder="请选择">
				    <el-option
				      v-for="item in options"
				      :key="item.value"
				      :label="item.label"
				      :value="item.value">
				    </el-option>
				  </el-select>
			</div>
			<div class="flex">
			    提现日期： 
				<el-date-picker
				      v-model="time"
					  size="mini"
					  value-format="yyyy-MM-dd"
				      type="daterange"
				      range-separator="至"
				      start-placeholder="开始日期"
				      end-placeholder="结束日期">
				</el-date-picker>
			</div>
			<div>
			    <el-button type="primary" size="mini" @click="search">检索</el-button>
			    <el-button size="mini" @click="clearSearch">重置/检索</el-button>
			</div>
		</div>
		<br>
		<el-table  :data="list"
			 border  
			 style="width: 100%"
			>
			<el-table-column   align="center"   label="审核状态">
				<template slot-scope="scope">
				   <div>
						<!-- <el-switch
						  @change="changeStatus(scope.row)"	
						  v-model="scope.row.status"
						 :inactive-value="'0'"
						 :active-value="'1'"
						 >
						</el-switch> -->
						{{scope.row.status==0?'待审核':'已审核'}}
				   </div>
				</template>
			</el-table-column>
			<el-table-column   align="center"    prop="name"    label="用户姓名"></el-table-column>
			<el-table-column   align="center"    prop="phone"    label="用户手机号"></el-table-column>
			<el-table-column   align="center"    prop="add_time"    label="提现时间"></el-table-column>
			<el-table-column   align="center"   prop="pay_time"    label="审核时间"></el-table-column>
			<el-table-column   align="center" width="150"   prop="money"    label="提现金额"></el-table-column>
			<el-table-column   align="center" width="150"     label="提现类型">
				<template slot-scope="scope">
				    <div>
						{{scope.row.acc_info.account_type}}
					</div>
				</template>
			</el-table-column>
			<el-table-column   align="center" width="150"     label="提现账户">
				<template slot-scope="scope">
				    <div>
						{{scope.row.acc_info.account_number}}
					</div>
				</template>
			</el-table-column>
		 <el-table-column  label="操作" fixed="left"  align="center">
		        <template slot-scope="scope">
					<span  
						v-if="scope.row.status==1"
						>
						--
					</span>
					<span  class="button_text"
						@click="shenhe(scope.row)"
						v-if="scope.row.status==0"
						>
						审核
					</span>
					
					
		        </template>
		    </el-table-column>
		</el-table>
		<div class="page">
		    <el-pagination
		            background
		            @size-change="pageChange"
		            @current-change="handleCurrentChange"
		            :current-page="page"
		            :page-size="pageSize"
		            layout="total, sizes, prev, pager, next, jumper"
		            :total="page_totle">
		    </el-pagination>
		</div>
		
		<el-dialog
		        title="审核"
				:close-on-click-modal="false"
		        :visible.sync="showForm"
		        width="800px"
		>
		  <div>
			  <el-form ref="form" :model="rowData" label-width="80px">
				  <el-form-item label="审核时间">
					  <el-date-picker
					        size="mini"
					        v-model="pay_time"
					  	    value-format="yyyy-MM-dd HH:mm:ss"
					        type="datetime"
					        placeholder="选择日期时间">
					  </el-date-picker>
				  </el-form-item>
				  <el-form-item label="">
				      <el-button type="primary" 
						:loading="isLoding"
						@click="shenheConfirm" size="small">确定</el-button>
				  </el-form-item>
			  </el-form>
		  </div>
		</el-dialog>
		
		
		
	</div>
</template>

<script>
	import selectUser from '@/components/selectUser'
	export default {
		components:{
			selectUser
		},
		data(){
			return {
				page:1,
				pageSize:10,
				page_totle:0,
				search_form:{
					mid:'',
					status:'-1',
					start_time:'',
					end_time:''
				},
				options:[
					{
						value: '-1',
						label: '全部'
					},
					{
						value: '0',
						label: '待审核'
					},
					{
						value: '1',
						label: '已审核'
					}
				],
				time:[],
				showForm:false,
				rowData:{
					
				},
				pay_time:'',
				isLoding:false,
			}
		},
		mounted() {
			this.lodeList()
		},
		methods:{
			changeStatus(row){
				// let params = {
				// 	id:row.id,
				// 	status:row.status
				// }
				// this.$post('/user/settixianStatus',params,res=>{
				// 	this.lodeList()
				// })
			},
			shenhe(row){
				this.rowData = row
				this.pay_time = this.$utils.formatNowDate(1)
				this.showForm = true
			},
			shenheConfirm(){
				let params = {
					id:this.rowData.id,
					pay_time:this.pay_time,
					status:'1'
				}
				this.isLoding = true
				this.$post('/user/checktixian',params,res=>{
					this.showForm = false
					this.isLoding = false
					this.lodeList()
				})
			},
			clearSearch(){
				this.search_form = {
					mid:'',
					status:'-1',
					start_time:'',
					end_time:''
				}
				this.time= []
				this.page = 1
				this.search()
			},
			getUserId(val){
				this.page = 1
				this.search_form.mid = val
				this.search()
			},
			lodeList(){
				let params = {
					page:this.page,
					pageSize:this.pageSize,
					search_form:this.search_form,
					mid:''
				}
				this.$post('/user/tixianList',params,res=>{
					let result = res.data
					
					this.list = result.data.result
					this.page_totle = result.data.count
				})
			},
		}
	}
</script>

<style>
</style>